package abc.com.abc.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

import abc.com.abc.R;
import abc.com.abc.bean.UserBean;

public class SelectAdapter extends RecyclerView.Adapter<SelectAdapter.ViewHolder>{
    private Context mcontext;
    private List<UserBean> list;
    public SelectAdapter(Context context, List list){
        this.list = list;
        this.mcontext = context;
    }
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mcontext).inflate(R.layout.select,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        UserBean bean = list.get(position);
        holder.username.setText(bean.userName);
        holder.name.setText(bean.name);
        holder.jiakao.setText(bean.jiakao);
        holder.jiaolian.setText(bean.jiaolian);
        holder.phone.setText(bean.phone);
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class ViewHolder extends RecyclerView.ViewHolder {
        private TextView name;
        private TextView username;
        private TextView jiakao;
        private TextView jiaolian;
        private TextView phone;

        public ViewHolder(View itemView) {

            super(itemView);
            name = itemView.findViewById(R.id.name);
            username = itemView.findViewById(R.id.username);
            jiakao = itemView.findViewById(R.id.jiakao);
            jiaolian = itemView.findViewById(R.id.jiaolian);
            phone = itemView.findViewById(R.id.phone);

        }
    }
}
